package search;

import java.io.IOException;

import org.junit.Test;

import search.model.SearchMeta;

import de.linguatools.disco.DISCO;
import de.linguatools.disco.ReturnDataBN;
import edu.smu.tspell.wordnet.Synset;
import edu.smu.tspell.wordnet.SynsetType;
import edu.smu.tspell.wordnet.WordNetDatabase;

import DAO.ICodeDAO;
import DAO.IDAO;
import DAO.IWordCodeDAO;
import DAO.IWordDAO;

public class Search {
	private SearchMeta meta;
	private IDAO dao;
	
	public Search() {}
	
//	public Search(IDAO dao) {
//		this.dao = dao;
//	}
	
	@Test
	public void search() {
//		ICodeDAO codeDAO = dao.getCodeDAO();
//		IWordDAO wrdDAO = dao.getWordDAO();
//		IWordCodeDAO wrdCdDAO = dao.getWordCodeDAO();
		try {
			System.setProperty("wordnet.database.dir", "C:/WordNet/2.1/dict");
			WordNetDatabase wrdNet = WordNetDatabase.getFileInstance();
			DISCO d = new DISCO("en_wiki", false);
			ReturnDataBN dtBn = d.similarWords("circle");
//			for(String v : dtBn.values) {
//				System.out.println(v);
//			}
//			System.out.println("-----------");
			for(int i = 0; i < dtBn.words.length; ++i) {
				System.out.println(dtBn.words[i] + " " + dtBn.values[i]);
				String[] orgs = wrdNet.getBaseFormCandidates(dtBn.words[i], SynsetType.NOUN);
				for(String s : orgs) {
					System.out.print(s + ",");
				}
				Synset[] types = wrdNet.getSynsets(dtBn.words[i]);
				for(Synset tp : types) {
					System.out.print(tp.getType() + ",");
				}
				System.out.println();
			}
//			for(String v : dtBn.words) {
//				System.out.println(v);
//			}
		} catch (IOException e) {
			e.printStackTrace();
		}
	}
}
